/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hidroponia;


import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.jai.Histogram;

public class ConexionBD{
    
    public Connection c = null;

    public void conectar() throws SQLException{
        
            try {
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
            } catch (SQLException ex) {
                Logger.getLogger(ConexionBD.class.getName()).log(Level.SEVERE, null, ex);
            }
            try {
                c = DriverManager.getConnection("jdbc:mysql://localhost/hidroponia","root","");
            } catch (SQLException ex) {
                Logger.getLogger(ConexionBD.class.getName()).log(Level.SEVERE, null, ex);
            }
            System.out.println("ME CONECTE CON EXITOOOOO!!!!!!!!!!");
    }

    public ResultSet consultar(String query) throws SQLException{
            ResultSet rs;
            Statement stmt = c.createStatement();
            rs = stmt.executeQuery(query);
            return rs;
        /*    while ( rs.next() ) {
                String lastName = rs.getString("Lname");
                System.out.println(lastName);
            } */  
    }




}